package com.baselib.android.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

public class ApplicationUtil {
    /**
     * 获取APP版本id
     *
     * @param mContext
     * @return
     */
    public static int getVersionCode(Context mContext) {
        try {
            PackageManager pm = mContext.getPackageManager();
            PackageInfo pinfo = pm.getPackageInfo((mContext.getPackageName()),
                    PackageManager.GET_CONFIGURATIONS);
            // String versionName = pinfo.versionName;
            int versionCode = pinfo.versionCode;
            return versionCode;
        } catch (PackageManager.NameNotFoundException e) {
        }
        return 1;

    }

}